var t = getApp();

Page({
    data: {
        page: 1,
        current_page: 1,
        last_page: 1,
        isLoadMore: !0
    },
    onLoad: function(t) {
        wx.setNavigationBarTitle({
            title: "分红份数明细"
        }), this.setData({
            page: 1,
            current_page: 1,
            last_page: 1,
            isLoadMore: !0,
            list: []
        }), this.getList();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore && this.getMore();
    },
    onShareAppMessage: function() {},
    getMore: function() {
        var a = this;
        if (this.data.isLoadMore = !1, !(this.data.current_page >= this.data.last_page)) {
            this.setData({
                page: this.data.page + 1
            });
            var e = t.getNetAddresss("plugin.share-partner.frontend.dividend.get-bonus-list");
            t._getNetWork({
                url: e,
                data: {
                    page: this.data.page
                },
                success: function(t) {
                    a.data.isLoadMore = !0;
                    var e = t.data;
                    1 == e.result ? a.setData({
                        list: a.data.list.concat(e.data.data),
                        current_page: e.data.current_page,
                        last_page: e.data.last_page
                    }) : wx.showToast({
                        icon: "none",
                        title: e.msg,
                        duration: 1500
                    });
                },
                fail: function(t) {
                    this.data.isLoadMore = !0, console.log(t);
                }
            });
        }
    },
    getList: function() {
        var a = this, e = t.getNetAddresss("plugin.share-partner.frontend.dividend.get-bonus-list");
        t._getNetWork({
            url: e,
            data: {
                page: this.data.page
            },
            success: function(t) {
                var e = t.data;
                1 == e.result ? a.setData({
                    list: e.data.data,
                    current_page: e.data.current_page,
                    last_page: e.data.last_page
                }) : wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    }
});